CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)

PROJECT(slog_sample LANGUAGES CXX)
SET(CMAKE_CXX_STANDARD 14)

IF(NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Debug)
ENDIF(NOT CMAKE_BUILD_TYPE)

IF(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
    ADD_DEFINITIONS(-D_ENABLE_SLOG)
ENDIF(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))

FIND_PACKAGE(GDAL)
IF(GDAL_FOUND)
    ADD_DEFINITIONS(-DUSE_CPLOGGER)
    INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIR})
ENDIF(GDAL_FOUND)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/*.h)

ADD_EXECUTABLE(slog_sample sample.cpp)

IF(GDAL_FOUND)
    TARGET_LINK_LIBRARIES(slog_sample ${GDAL_LIBRARY})
ENDIF(GDAL_FOUND)
